﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MvcContrib.Pagination.IPagination<Sinbiota.Web.Models.OccurrenceWithUserPermission>>" %>
<%@ Import Namespace="Localization" %>
<%@ Import Namespace="MvcContrib.UI.Pager" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <%: Strings.Occurrences %>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server"> 
    <script type="text/javascript" src="<%: Url.Content("~/Scripts/Custom/BiotaAjaxFunctions.js")%>"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div id="OccurrenceDetails" title="<%: Strings.Occurrence %>">
    </div>
    <div class="right"  style="position:relative;top:20px;">
        <%: Html.ActionLink(Strings.NewSearch, "Search", "Occurrence", null, new { Class = ViewData["actionButtonClass"]+" right"})%>
        <%: Html.ActionLink(Strings.ViewResultsOnMap, "Ajax", "Map", new { cacheKey = ViewData["PagedListGuid"] }, new { Class = ViewData["actionButtonClass"] + " right", target = "_blank" })%>
    </div>
    <h2><%: Strings.Occurrences %></h2>
        
        <input type="hidden" name="PagedListGuid" id ="PagedListGuid" value="<%: ViewData["PagedListGuid"] %>"/>
        <%= Html.Pager(Model)
            .Format(Strings.HtmlPagerFormat).SingleFormat(Strings.HtmlPagerSingleFormat)
                        .First(string.Format("<img src='{0}' title='{1}' class='pagination'>", Url.Content("~/Content/img/Rewind.png"),Strings.FirstPage))
                        .Next(string.Format("<img src='{0}' title='{1}' class='pagination'>", Url.Content("~/Content/img/Right.png"), string.Format("{0} ({1})", Strings.NextPage, Math.Min(Model.TotalPages,Model.PageNumber+1))))
                        .Previous(string.Format("<img src='{0}' title='{1}' class='pagination'>", Url.Content("~/Content/img/Left.png"), string.Format("{0} ({1})", Strings.PreviousPage, Math.Max(1, Model.PageNumber - 1))))
                                    .Last(string.Format("<img src='{0}' title='{1}' class='pagination'> </a><div class='right'>{2} <span class='round red label'>{3}</span> / <span class='round red label'>{4}</span></div>",
                                        Url.Content("~/Content/img/Forward.png"), string.Format("{0} ({1})", Strings.LastPage, Model.TotalPages), Strings.Page, Model.PageNumber, Model.TotalPages))
                        .Link(x => Url.Action("Search", new { page = x, PagedListGuid = ViewData["PagedListGuid"] }))
            
        %>
        
        <% Html.RenderPartial("ListUserControl", Model); %>  

<p>
        <%: Html.ActionLink(Strings.SearchOccurrences, "Search", "Occurrence", null, new { Class = ViewData["actionButtonClass"] })%>
</p>
<script type="text/javascript">
    $().ready(function () {
        $("img.pagination").tipTip();
    });
    </script>

</asp:Content>
